﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SIBI.Helpers
{
    public static class Helpers
    {
        public static MvcHtmlString UppercaseFirst(this HtmlHelper helper, string target)
        {
            if (target != string.Empty)
            {
                var splitt = target.Split(' ');
                var ret = "";
                for (var i = 0; i < splitt.Length; i++)
                {
                    if(splitt[i]!=""){
                        ret += splitt[i].Substring(0, 1) + splitt[i].ToLower().Substring(1) + " ";
                    }
                }
                ret = ret.Replace("&#209;", "&#241;"); 

                return MvcHtmlString.Create(ret);
            }
            else 
            {
                return MvcHtmlString.Create(string.Empty);
            }
        }
    }
}